# 正则表达式判断字符串是否是日期
import re


def date_is_right(date):
    return re.match("\d{4}-\d{2}-\d{2}", date) is not None


date1 = "20220321"
date2 = "2022/03/21"
date3 = "2022-03-21"
date4 = "202a-03-21"

print(date_is_right(date1))
print(date_is_right(date2))
print(date_is_right(date3))
print(date_is_right(date4))
